<template>
	<view class="mainpadding dingwei beijingse">
		<view class="hongmb"></view>
		<view class="mainpadding ffffff radius dingwei">
			<view class="ershiba xiaohei textcenter">储值 (元）</view>
			<view class="fonweight xiaohei margin_top2 textcenter" style="font-size: 52rpx;">{{userinfo.money}}</view>
			<view class="flexcenter">
				<view class="chongzbtn flexcenter margin_right" @click="tzcz">充值</view>
				<view class="chongzbtn flexcenter"@click="jumper('/pages_mine/tixian?type=2')">提现</view>
			</view>
		</view>
		<view class="margin_top ffffff radius mainpadding">
			<view class="flexbetween">
				<view class="sanshier xiaohei fonweight">储值明细</view>
				<view class="flexright"  @click="tzckgd">
					<view class="ershiba xiaohei">查看更多</view>
					<u-icon name="arrow-right"></u-icon>
				</view>
			</view>
			<view class="flexcenter" v-if="!list.data.length">
				<view class="placeholderimage" style="margin-top: 100rpx;"></view>
			</view>
			<view class="margin_top flexbetween" v-for="item in list.data" :key="item.id">
				<view class="">
					<view class="sanshier xiaohei">{{item.memo}}</view>
					<view class="ershiba xiaohui margin_top1">{{item.createtime_text}}</view>
				</view>
				<view class="flexleft">
					<!-- <view class="sanshier xiaohei fonweight">-</view> -->
					<!-- <view class="sanshier xiaohei fonweight">+</view> -->
					<view class="sanshier xiaohei fonweight">{{item.money}}</view>
					<!-- <u-icon name="arrow-right" color="#999999" size="16"></u-icon> -->
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				userinfo: {},
				page: 1,
				limit: 12,
				list: {
					data: []
				},
			}
		},
		onShow() {
			this.getinfo()
			this.init()
		},
		methods: {
			jumper(url) {
				uni.navigateTo({
					url: url
				})
			},
			init(isPage, page) { //提现记录
				let _this = this;
				let url = '/api/user/getUserMoneyLog'
				httpRequest.request(url, 'GET', {
					page: page || 1,
					limit: _this.limit,
					type:0
				}, false, false, true).then(res => {
					if (res.code == 1) {
						let resList = res.data;
						let dataList = _this.list;
						if (isPage == true) {
							_this.list.data = dataList.data.concat(resList.data);
						} else {
							this.list = res.data
							_this.list.data = resList.data;
						}
					}
				}).catch(err => {
					httpRequest.toast(err.msg);
				})
			},
			// onReachBottom() {
			// 	let _this = this;
			// 	let list = _this.list;
			// 	let page = _this.page;
			// 	if (list.last_page <= page) {
			// 		return false;
			// 	}
			// 	page++;
			// 	_this.page = page;
			// 	_this.init(true, page);
			// },
			getinfo() {
				httpRequest.request('/api/user/index', 'GET', {}).then(res => {
					this.userinfo = res.data
				})
			},
			// 跳转明细
			tzckgd() {
				uni.navigateTo({
					url: '/pages_mine/chuzhimingx?type=1'
				})
			},
			// 跳转充值
			tzcz() {
				uni.navigateTo({
					url: '/pages_mine/chuzhicz'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.hongmb {
		position: absolute;
		top: 0;
		left: 0;
		z-index: 0;
		width: 750rpx;
		height: 250rpx;
		background: linear-gradient(179deg, #FED6D0 0%, #FFE8E6 100%);
	}

	.chongzbtn {
		margin: 90rpx auto 0;
		width: 180rpx;
		height: 70rpx;
		background: linear-gradient(180deg, #F7903D 0%, #ED6A2C 100%);
		border-radius: 33rpx 33rpx 33rpx 33rpx;
		font-size: 32rpx;
		font-weight: 500;
		color: #FFFFFF;
	}
</style>